package ace.module.account.core.impl.dao.repository;

import ace.cmp.spring.data.jdbc.querydsl.core.repository.QuerydslJdbcBaseRepository;
import ace.module.account.core.impl.constant.AccountCoreConstant;
import ace.module.account.core.impl.dao.entity.IamAccountPassport;
import com.baomidou.dynamic.datasource.annotation.DS;
import java.util.List;
import org.springframework.stereotype.Repository;

/**
 * 账户通过证 repository.
 *
 * @author Caspar
 */
@DS(AccountCoreConstant.DEFAULT_DATA_SOURCE_NAME)
@Repository
public interface IamAccountPassportRepository
    extends QuerydslJdbcBaseRepository<IamAccountPassport, Long> {

  Boolean existsByIamAppIdAndPassportTypeAndPassportAndDeleteFlag(
      Long iamAppId,
      Integer passportType,
      String passport,
      Long deleteFlag);

  Boolean existsByIamAppIdAndPassportAndPassport2AndPassportTypeAndDeleteFlag(
      Long iamAppId,
      String passport,
      String passport2,
      Integer passportType,
      Long deleteFlag);

  Boolean existsByIamAppIdAndPassportAndPassport2AndPassport3AndPassportTypeAndDeleteFlag(
      Long iamAppId,
      String passport,
      String passport2,
      String passport3,
      Integer passportType,
      Long deleteFlag);

  List<IamAccountPassport> getByIamAppIdAndPassportAndPassportTypeInAndDeleteFlag(
      Long iamAppId,
      String passport,
      List<Integer> passportTypes,
      Long deleteFlag);

  IamAccountPassport getByIamAppIdAndPassportAndPassportTypeAndDeleteFlag(
      Long iamAppId,
      String passport,
      Integer passportType,
      Long deleteFlag);

  IamAccountPassport getByIamAppIdAndPassportAndPassport2AndPassport3AndPassportTypeAndDeleteFlag(
      Long iamAppId,
      String passport,
      String passport2,
      String passport3,
      Integer passportType,
      Long deleteFlag);

  IamAccountPassport getByIamAppIdAndIamAccountIdAndPassportTypeAndDeleteFlag(Long iamAppId, Long iamAccountId, Integer passportType, Long deleteFlag);

  List<IamAccountPassport> getByIamAccountIdInAndPassportTypeAndDeleteFlag(List<Long> iamAccountIds, Integer passportType, Long deleteFlag);

  IamAccountPassport getByIamAccountIdAndPassportTypeAndDeleteFlag(Long iamAccountId, Integer passportType, Long deleteFlag);
}
